import type { type } from '@/types/user'
import { defineStore } from 'pinia'
import { ref } from 'vue'
//需要一个持久化插件
export const useUserStore = defineStore(
  'user',
  () => {
    const user = ref<type>({} as type)
    const setUser = (obj: type) => {
      user.value = obj
    }
    const clearUser = () => {
      user.value = {} as type
    }
    return { user, setUser, clearUser }
  },
  {
    // @ts-ignore
    unistorage: true,
  }
)
